package com.hx.base.others;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author jxlgcmh
 * @create 2019-07-03 16:11
 */
public class SubListTest {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        //List<Integer> subList = arrayList.subList(1, 2);
        // java.util.ArrayList$SubList cannot be cast to java.util.ArrayList
        // 下面的不能强转
        // ArrayList<Integer> res=(ArrayList<Integer>)arrayList.subList(1, 2);
        // System.out.println(res);
        Integer[] arr = {};
        arr = arrayList.toArray(arr);
        System.out.println(Arrays.toString(arr));

    }
}
